Move
A Move command is a request to move an object or objects. The Finder version of the Move command is similar to the version described in the AppleScript Language Guide, except that the Finder's Move command allows you to specify whether or not to replace items in the destination container.SYNTAX
move referenceToObject to referenceToContainer ¬ [ replacing ( conflicts | existing items ) ]PARAMETERS
- referenceToObject
- A reference to the object to move or a list of references.
Class: Reference or list of references- referenceToContainer
- A reference to the location to which to move the object
(see "Notes").
Class: ReferenceRESULT
A reference to the object that was moved or a list of references.EXAMPLE
This script moves a file into a folder, replacing any files of the same name that exist in that folder:
tell application "Finder" move file "My File" of startup disk ¬ to folder "My Folder" of startup disk ¬ replacing conflicts end tellYou can usereplacing existing items
,with replacing
, orreplacing true
instead ofreplacing conflicts
without changing
the meaning of this script.NOTES
If an object specified by the referenceToObject parameter is located on a different disk from the container specified by the referenceToContainer parameter, the Move command copies the object instead of moving it, but doesn't provide any warning that it has failed to remove the original object. To move any object from one disk to another, copy the object to the new disk (using either the Move or the Copy command), then delete the original object using the Delete command. See page 121 for an example of a script that uses this technique.